{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Title: #Determine if Two Events Have Conflict"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Difficulty: #Easy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Category Title: #Algorithms"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tag Slug: #array #string"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Name Translated: #数组 #字符串"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solution Name: haveConflict"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Title: #判断两个事件是否存在冲突"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Content:\n",
    "<p>给你两个字符串数组 <code>event1</code> 和&nbsp;<code>event2</code>&nbsp;，表示发生在同一天的两个闭区间时间段事件，其中：</p>\n",
    "\n",
    "<ul>\n",
    "\t<li><code>event1 = [startTime<sub>1</sub>, endTime<sub>1</sub>]</code> 且</li>\n",
    "\t<li><code>event2 = [startTime<sub>2</sub>, endTime<sub>2</sub>]</code></li>\n",
    "</ul>\n",
    "\n",
    "<p>事件的时间为有效的 24 小时制且按&nbsp;<code>HH:MM</code>&nbsp;格式给出。</p>\n",
    "\n",
    "<p>当两个事件存在某个非空的交集时（即，某些时刻是两个事件都包含的），则认为出现 <strong>冲突</strong>&nbsp;。</p>\n",
    "\n",
    "<p>如果两个事件之间存在冲突，返回&nbsp;<code>true</code><em>&nbsp;</em>；否则，返回<em>&nbsp;</em><code>false</code> 。</p>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><b>示例 1：</b></p>\n",
    "\n",
    "<pre>\n",
    "<b>输入：</b>event1 = [\"01:15\",\"02:00\"], event2 = [\"02:00\",\"03:00\"]\n",
    "<b>输出：</b>true\n",
    "<b>解释：</b>两个事件在 2:00 出现交集。\n",
    "</pre>\n",
    "\n",
    "<p><b>示例 2：</b></p>\n",
    "\n",
    "<pre>\n",
    "<b>输入：</b>event1 = [\"01:00\",\"02:00\"], event2 = [\"01:20\",\"03:00\"]\n",
    "<b>输出：</b>true\n",
    "<b>解释：</b>两个事件的交集从 01:20 开始，到 02:00 结束。\n",
    "</pre>\n",
    "\n",
    "<p><strong>示例 3：</strong></p>\n",
    "\n",
    "<pre>\n",
    "<b>输入：</b>event1 = [\"10:00\",\"11:00\"], event2 = [\"14:00\",\"15:00\"]\n",
    "<b>输出：</b>false\n",
    "<b>解释：</b>两个事件不存在交集。\n",
    "</pre>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><b>提示：</b></p>\n",
    "\n",
    "<ul>\n",
    "\t<li><code>event1.length == event2.length == 2.</code></li>\n",
    "\t<li><code>event1[i].length == event2[i].length == 5</code></li>\n",
    "\t<li><code>startTime<sub>1</sub> &lt;= endTime<sub>1</sub></code></li>\n",
    "\t<li><code>startTime<sub>2</sub> &lt;= endTime<sub>2</sub></code></li>\n",
    "\t<li>所有事件的时间都按照&nbsp;<code>HH:MM</code>&nbsp;格式给出</li>\n",
    "</ul>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Description: [determine-if-two-events-have-conflict](https://leetcode.cn/problems/determine-if-two-events-have-conflict/description/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solutions: [determine-if-two-events-have-conflict](https://leetcode.cn/problems/determine-if-two-events-have-conflict/solutions/)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_cases = ['[\"01:15\",\"02:00\"]\\n[\"02:00\",\"03:00\"]', '[\"01:00\",\"02:00\"]\\n[\"01:20\",\"03:00\"]', '[\"10:00\",\"11:00\"]\\n[\"14:00\",\"15:00\"]']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not (event1[0]>event2[1] or event1[1]<event2[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        def transfer(t):\n",
    "            return 60*int(t[:2])+int(t[3:])\n",
    "        if transfer(event1[0]) > transfer(event2[0]):\n",
    "            event1,event2 = event2,event1\n",
    "        if transfer(event2[0])>transfer(event1[1]):\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if event1[1] < event2[0] or event2[1] < event1[0]:\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        event1sta = event1[0]\n",
    "        event1end = event1[1]\n",
    "        event2sta = event2[0]\n",
    "        event2end = event2[1]\n",
    "        if (event2sta >= event1sta) and (event2sta <= event1end):\n",
    "            return True\n",
    "        if (event2end >= event1sta) and (event2end <= event1end):\n",
    "            return True\n",
    "        if (event2sta < event1sta) and (event2end > event1end):       \n",
    "            return True\n",
    "        return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        s1,e1=event1[0],event1[1]\n",
    "        s2,e2=event2[0],event2[1]\n",
    "        if s1>e2 or s2>e1:\n",
    "            return False\n",
    "        if s1<=e2:\n",
    "            if e1<s2:\n",
    "                return False\n",
    "            else:\n",
    "                return True\n",
    "        if s2<=e1:\n",
    "            if e2<s1:\n",
    "                return False\n",
    "            else:\n",
    "                return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not(event1[1]<event2[0] or event1[0]>event2[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return event1[0]<=event2[1] and event1[1]>=event2[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if event1[0]>event2[0]:\n",
    "            event1,event2=event2,event1\n",
    "        return True if event1[1]>=event2[0] else False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        res1, res2 = [], []\n",
    "        for ev1,ev2 in zip(event1, event2):\n",
    "            hour1, minute1 = ev1.split(':')\n",
    "            hour2, minute2 = ev2.split(':')\n",
    "            res1.append(int(hour1) * 60 + int(minute1))\n",
    "            res2.append(int(hour2) * 60 + int(minute2))\n",
    "        # print(res1, res2)\n",
    "        return (res1[1] >= res2[0] and res1[1] <= res2[1]) or (res2[1] >= res1[0] and res2[1] <= res1[1])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not(event1[1] < event2[0] or event2[1] < event1[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if event1[0] <= event2[0]:\n",
    "            return event1[1] >= event2[0]\n",
    "        else:\n",
    "            return event2[1] >= event1[0]\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if event1[1] < event2[0] or event2[1] <event1[0]:\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not(event1[1] < event2[0] or event2[1] < event1[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        start1 = int(event1[0][:2])+int(event1[0][3:5])*0.01\n",
    "        end1 = int(event1[1][:2])+int(event1[1][3:5])*0.01\n",
    "        start2 = int(event2[0][:2])+int(event2[0][3:5])*0.01\n",
    "        end2 = int(event2[1][:2])+int(event2[1][3:5])*0.01\n",
    "\n",
    "        if end1<start2 or end2<start1:\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        def convert(t):\n",
    "            h, m = map(int, t.split(':'))\n",
    "            return h * 60 + m\n",
    "        event1 = [convert(t) for t in event1]\n",
    "        event2 = [convert(t) for t in event2]\n",
    "        if event1[1] < event2[0] or event1[0] > event2[1]:\n",
    "            return False\n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return event1[1] >= event2[0] and event1[0] <= event2[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not (event2[0] > event1[1] or event2[1] < event1[0])\n",
    "           "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        def  min(time):\n",
    "            [hour, minutes] = time.split(':')\n",
    "            hour, minutes = int(hour), int(minutes)\n",
    "            return hour* 60 + minutes\n",
    "        e1s , e1e = min(event1[0]), min(event1[1])\n",
    "        e2s , e2e = min(event2[0]), min(event2[1])\n",
    "\n",
    "        if e1s > e2e or e2s > e1e:\n",
    "            return False\n",
    "        else:\n",
    "            # print(e1s,e1e,e2s,e2e)\n",
    "            return True "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if event1[0] == event2[1] or event1[1] == event2[0] \\\n",
    "         or event1[0] == event2[0]:\n",
    "            return True\n",
    "        elif event1[0] > event2[0]:\n",
    "            return True if event1[0] < event2[1] else False\n",
    "        elif event1[0] < event2[0]:\n",
    "            return True if event1[1] > event2[0] else False\n",
    "\n",
    "         "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return event1[1]>=event2[0] if event1[0]<event2[0] else event2[1]>=event1[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not(event1[1] < event2[0] or event2[1] < event1[0])\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not(event1[1] < event2[0] or event2[1] < event1[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return event1[1]>=event2[0] and event1[0]<=event2[1]\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        event1sta = event1[0]\n",
    "        event1end = event1[1]\n",
    "        event2sta = event2[0]\n",
    "        event2end = event2[1]\n",
    "        if (event2sta >= event1sta) and (event2sta <= event1end):\n",
    "            return True\n",
    "        if (event2end >= event1sta) and (event2end <= event1end):\n",
    "            return True\n",
    "        if (event2sta < event1sta) and (event2end > event1end):       \n",
    "            return True\n",
    "        return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if event1[0] in event2 or event1[1] in event2:\n",
    "            return True\n",
    "        if event1[0] > event2[0] and event1[0] < event2[1]:\n",
    "            return True\n",
    "        elif event2[0] > event1[0] and event2[0] < event1[1]:\n",
    "            return True\n",
    "        return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        a = max(event1[0], event2[0])\n",
    "        b = min(event1[1], event2[1])\n",
    "        s1 = int(a[:2]) * 60 + int(a[3:])\n",
    "        s2 = int(b[:2]) * 60 + int(b[3:])\n",
    "        return s2 - s1 >= 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        [e1t1s,e1t2s]=event1\n",
    "        [e2t1s,e2t2s]=event2\n",
    "        def get_time(t):\n",
    "            [h,m]=t.split(':')\n",
    "            return 60*int(h)+int(m)\n",
    "        e1t1=get_time(e1t1s)\n",
    "        e1t2=get_time(e1t2s)\n",
    "        e2t1=get_time(e2t1s)\n",
    "        e2t2=get_time(e2t2s)\n",
    "        return e1t1<=e2t1<=e1t2 or e1t1<=e2t2<=e1t2 or e2t1<=e1t1<=e2t2 or e2t1<=e1t2<=e2t2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "\n",
    "        if (event1[0]<=event2[0]<=event1[1]) or (event1[0]<=event2[1]<=event1[1]) or (event2[0]<=event1[1]<=event2[1]) or (event2[0]<=event1[0]<=event2[1]) :\n",
    "            return True\n",
    "        return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        def timeChg(HHMM):\n",
    "            HH,MM = HHMM.split(':')\n",
    "            miniutes = int(HH) * 60 + int(MM)\n",
    "            return miniutes\n",
    "        start1,end1 = event1\n",
    "        start2, end2 = event2\n",
    "        if timeChg(end1) < timeChg(start2) or timeChg(end2) < timeChg(start1):\n",
    "            return False\n",
    "        if timeChg(start2) <= timeChg(end1) or timeChg(start1) <= timeChg(end2):\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if int(event1[1][0:2])<int(event2[0][0:2]):\n",
    "            return False\n",
    "        elif int(event1[1][0:2])==int(event2[0][0:2]) and int(event1[1][3:5])<int(event2[0][3:5]):\n",
    "            return False\n",
    "        elif int(event2[1][0:2])<int(event1[0][0:2]):\n",
    "            return False\n",
    "        elif int(event2[1][0:2])==int(event1[0][0:2]) and int(event2[1][3:5])<int(event1[0][3:5]):\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return event1[0] <= event2[1] and event1[1] >= event2[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "t = time.fromisoformat\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return t(event1[0]) <= t(event2[1]) and t(event1[1]) >= t(event2[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "# import numpy as np\n",
    "# from datetime import *\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not (event1[1]<event2[0] or event2[1]<event1[0])\n",
    "\n",
    "        # if event1[1]<event2[0] or event2[1]<event1[0]:\n",
    "        #     return False\n",
    "        # else:\n",
    "        #     return True\n",
    "          \n",
    "        # star1 = event1[0]\n",
    "        # star2 = event2[0]\n",
    "        # star1 = datetime.strptime(star1,\"%H:%M\")\n",
    "        # star2 = datetime.strptime(star2,\"%H:%M\")\n",
    "        # end1= datetime.strptime(event1[1],\"%H:%M\")\n",
    "        # end2= datetime.strptime(event2[1],\"%H:%M\")\n",
    "        # if star1<star2 and end1<star2:\n",
    "        #     return False\n",
    "        # elif star2<star1 and end2<star1:\n",
    "        #     return False\n",
    "        # else:\n",
    "        #     return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return max(event1[0], event2[0]) <= min(event1[1], event2[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        a,b,c,d=[],[],[],[]\n",
    "        for i in event1[0]:\n",
    "           if i != \":\": \n",
    "            a.append(int(i))\n",
    "        for i in event1[1]:\n",
    "           if i != \":\": \n",
    "            b.append(int(i))            \n",
    "        for i in event2[0]:\n",
    "           if i != \":\": \n",
    "            c.append(int(i))\n",
    "        for i in event2[1]:\n",
    "           if i != \":\": \n",
    "            d.append(int(i))                        \n",
    "        result1 = 0\n",
    "        result2 = 0\n",
    "        result3 = 0\n",
    "        result4 = 0    \n",
    "        for i in a:\n",
    "         result1 = result1 * 10 + i\n",
    "        for i in b:\n",
    "         result2 = result2 * 10 + i\n",
    "        for i in c:\n",
    "         result3 = result3 * 10 + i\n",
    "        for i in d:\n",
    "         result4 = result4 * 10 + i                                  \n",
    "        if result3>result2 and result4>result1:\n",
    "            return False\n",
    "        elif result3<result2 and result4<result1:\n",
    "            return False\n",
    "        else:\n",
    "            return True       \n",
    "\n",
    "        # m=list(event1[1][0]+event1[1][1]+event1[1][3]+event1[1][4])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if event1[0] > event2[1] or event1[1] < event2[0]:\n",
    "            return False\n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if (int(event1[1].split(':')[0])<int(event2[0].split(':')[0])) or (int(event1[1].split(':')[0])==int(event2[0].split(':')[0]) and int(event1[1].split(':')[1])<int(event2[0].split(':')[1])) or(int(event2[1].split(':')[0])<int(event1[0].split(':')[0])) or (int(event2[1].split(':')[0])==int(event1[0].split(':')[0]) and int(event2[1].split(':')[1])<int(event1[0].split(':')[1])) :\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if event1[0] > event2[1] or event2[0] > event1[1]:\n",
    "            return False\n",
    "        return True\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        st1, et1, st2, et2 = [int(x[:2]) + int(x[3:])/60 for x in event1 + event2]\n",
    "\n",
    "        if (st1 <= et2 and st1 >=st2) or (et1 <= et2 and et1 >=st2) or \\\n",
    "        (st2 <= et1 and st2 >=st1) or (et2 <= et1 and et2 >=st1):\n",
    "            return True\n",
    "        return False\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return (event1[0] <= event2[1] and event2[0] <= event1[1])\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: list[str], event2: list[str]) -> bool:\n",
    "        s1 = int(event1[0][:2]) * 60 + int(event1[0][3:])\n",
    "        e1 = int(event1[1][:2]) * 60 + int(event1[1][3:])\n",
    "        s2 = int(event2[0][:2]) * 60 + int(event2[0][3:])\n",
    "        e2 = int(event2[1][:2]) * 60 + int(event2[1][3:])\n",
    "        if s2 <= s1 and e2 >= s1:\n",
    "            return True\n",
    "        if s2 > s1 and (e2 <= e1 or s2 <= e1):\n",
    "            return True\n",
    "        return False\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if event1[1] < event2[0] or event2[1] <event1[0]:\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "\n",
    "        c = []\n",
    "        d = []\n",
    "        e = ''\n",
    "        f = \"\"\n",
    "        for i in event2:\n",
    "            for m in i:\n",
    "                if m == ':':\n",
    "                    pass\n",
    "                else:\n",
    "                    c.append(m)\n",
    "        for i in c[0:4]:\n",
    "            e += i\n",
    "        d.append(e)\n",
    "        for i in c[4::]:\n",
    "            f += i\n",
    "        d.append(f)\n",
    "\n",
    "        g = []\n",
    "        a = []\n",
    "        s = ''\n",
    "        j = \"\"\n",
    "        for i in event1:\n",
    "            for m in i:\n",
    "                if m == ':':\n",
    "                    pass\n",
    "                else:\n",
    "                    g.append(m)\n",
    "        for i in g[0:4]:\n",
    "            s += i\n",
    "        a.append(s)\n",
    "        for i in g[4::]:\n",
    "            j += i\n",
    "        a.append(j)\n",
    "\n",
    "        for i in range(int(d[0]), int(d[1]) + 1):\n",
    "            for p in range(int(a[0]), int(a[1]) + 1):\n",
    "                if i == p:\n",
    "                    return True\n",
    "\n",
    "        return False\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        st1 = int(event1[0][0:2])*60 + int(event1[0][3:5])\n",
    "        ed1 = int(event1[1][0:2])*60 + int(event1[1][3:5])\n",
    "        st2 = int(event2[0][0:2])*60 + int(event2[0][3:5])\n",
    "        ed2 = int(event2[1][0:2])*60 + int(event2[1][3:5])\n",
    "        if ed1<st2 or ed2<st1:\n",
    "            return False\n",
    "        else:\n",
    "            return True\n",
    "        \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return max(event1[0], event2[0]) <= min(event1[1], event2[1])\n",
    "        \n",
    "\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        def tarnsform(time):\n",
    "            hour,minute=int(time[:2]),int(time[-2:])\n",
    "            return hour*60+minute\n",
    "        event1=list(map(tarnsform,event1))\n",
    "        event2=list(map(tarnsform,event2))\n",
    "        if event1[0]>event2[1] or event2[0]>event1[1]: return False\n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not (event1[1] < event2[0] or event2[1] < event1[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        c = []\n",
    "        d = []\n",
    "        e = ''\n",
    "        f = \"\"\n",
    "        for i in event2:\n",
    "            for m in i:\n",
    "                if m == ':':\n",
    "                    pass\n",
    "                else:\n",
    "                    c.append(m)\n",
    "        for i in c[0:4]:\n",
    "            e += i\n",
    "        d.append(e)\n",
    "        for i in c[4::]:\n",
    "            f += i\n",
    "        d.append(f)\n",
    "        g = []\n",
    "        a = []\n",
    "        s = ''\n",
    "        j = \"\"\n",
    "        for i in event1:\n",
    "            for m in i:\n",
    "                if m == ':':\n",
    "                    pass\n",
    "                else:\n",
    "                    g.append(m)\n",
    "        for i in g[0:4]:\n",
    "            s += i\n",
    "        a.append(s)\n",
    "        for i in g[4::]:\n",
    "            j += i\n",
    "        a.append(j)\n",
    "\n",
    "        for i in range(int(d[0]), int(d[1]) + 1):\n",
    "            for p in range(int(a[0]), int(a[1]) + 1):\n",
    "                if i == p:\n",
    "                    return True\n",
    "\n",
    "        return False\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not(event1[0]>event2[1] or event1[1]<event2[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return event1[0] <= event2[1] and event1[1] >= event2[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not(event1[1] < event2[0] or event2[1] < event1[0])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not(event1[1] < event2[0] or event2[1] < event1[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not (event1[1] < event2[0] or event1[0] > event2[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return max(event1[0], event2[0]) <= min(event1[1], event2[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if event1[0]<=event2[0]<=event1[1] or event1[0]<=event2[1]<=event1[1] or event2[0]<=event1[0]<=event2[1] or event2[0]<=event1[1]<=event2[1]:\n",
    "            return True\n",
    "        else:\n",
    "            return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return event1[0]<=event2[1] and event2[0]<=event1[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        import re\n",
    "        startTime1,endTime1 = event1\n",
    "        prog = re.compile(r'(\\d{2})\\:(\\d{2})')\n",
    "        m = prog.search(startTime1)\n",
    "        startMin1 = int(m.group(1)) * 60 + int(m.group(2))\n",
    "        m = prog.search(endTime1)\n",
    "        endMin1 = int(m.group(1)) * 60 + int(m.group(2))\n",
    "\n",
    "        startTime2,endTime2 = event2\n",
    "\n",
    "        m = prog.search(startTime2)\n",
    "        startMin2 = int(m.group(1)) * 60 + int(m.group(2))\n",
    "        m = prog.search(endTime2)\n",
    "        endMin2 = int(m.group(1)) * 60 + int(m.group(2)) \n",
    "\n",
    "        if min(endMin1,endMin2) >= max(startMin1,startMin2):\n",
    "            return True\n",
    "        else:\n",
    "            return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return event2[0] <= event1[1] and event2[1]>= event1[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        s1 = int(event1[0][:2]) * 60 + int(event1[0][3:])\n",
    "        e1 = int(event1[1][:2]) * 60 + int(event1[1][3:])\n",
    "        s2 = int(event2[0][:2]) * 60 + int(event2[0][3:])\n",
    "        e2 = int(event2[1][:2]) * 60 + int(event2[1][3:])\n",
    "        return min(e1, e2) - max(s1, s2) >= 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        time1 = [int(i) for i in event1[0].split(':')]\n",
    "        time2 = [int(i) for i in event1[1].split(':')]\n",
    "        time3 = [int(i) for i in event2[0].split(':')]\n",
    "        time4 = [int(i) for i in event2[1].split(':')]\n",
    "        \n",
    "        time1 = time1[0]*60+time1[1]\n",
    "        time2 = time2[0]*60+time2[1]\n",
    "        time3 = time3[0]*60+time3[1]\n",
    "        time4 = time4[0]*60+time4[1]\n",
    "        \n",
    "        if time3 > time2:\n",
    "            return False\n",
    "        elif time1 > time4:\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        \n",
    "        if int(event2[0][:2])>=int(event1[1][:2]):\n",
    "            if int(event2[0][:2])==int(event1[1][:2]) and int(event2[0][3:])>int(event1[1][3:]):\n",
    "                return False\n",
    "            elif int(event2[0][:2])>int(event1[1][:2]): return False\n",
    "        if int(event1[0][:2])>=int(event2[1][:2]):\n",
    "            if int(event1[0][:2])==int(event2[1][:2]) and int(event1[0][3:])>int(event2[1][3:]):\n",
    "                return False\n",
    "            elif int(event1[0][:2])>int(event2[1][:2]): return False\n",
    "    \n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not(event1[1]<event2[0] or event1[0]>event2[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        def settime(s):\n",
    "            hour=int(s[:2])\n",
    "            minute=int(s[3:])\n",
    "            return hour*100+minute\n",
    "        start=settime(event1[0])\n",
    "        end=settime(event1[1])\n",
    "        if start>end:\n",
    "            end+=2400\n",
    "        time1=settime(event2[0])\n",
    "        if time1>=start and time1<=end:\n",
    "            return True\n",
    "        time2=settime(event2[1])\n",
    "        if time2<time1:\n",
    "            time2+=2400\n",
    "        if time2>=start and time2<=end:\n",
    "            return True\n",
    "        if start>=time1 and start<=time2:\n",
    "            return True\n",
    "        return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        if event1[1] < event2[0] or event2[1] < event1[0]:\n",
    "            return False\n",
    "        return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return event1[0] <= event2[1] and event1[1] >= event2[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "        def stringtominutes(string):\n",
    "\n",
    "            h, m = string.split(\":\")\n",
    "\n",
    "            h = int(h)\n",
    "            m = int(m)\n",
    "\n",
    "            return h * 60 + m\n",
    "\n",
    "        \n",
    "        start1, end1 = stringtominutes(event1[0]), stringtominutes(event1[1])\n",
    "        start2, end2 = stringtominutes(event2[0]), stringtominutes(event2[1])\n",
    "\n",
    "        if start1 > start2: return self.haveConflict(event2, event1)\n",
    "        return False if (end1 < start2) else True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        def get_minutes(s):\n",
    "            ans=0\n",
    "            ans+=int(s[0:2])*60\n",
    "            ans+=int(s[3:])\n",
    "            return ans\n",
    "        a=get_minutes(event1[1])\n",
    "        b=get_minutes(event2[0])\n",
    "        c=get_minutes(event2[0])\n",
    "        d=get_minutes(event1[0])\n",
    "        if d==c:\n",
    "            return True\n",
    "        if d>c:\n",
    "            return self.haveConflict(event2, event1)\n",
    "        if a>=b:\n",
    "            return True\n",
    "        return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        first1 = float(event1[0].replace(\":\",\".\"))\n",
    "        first2 = float(event1[1].replace(\":\",\".\"))\n",
    "        second1 = float(event2[0].replace(\":\",\".\"))\n",
    "        second2 = float(event2[1].replace(\":\",\".\"))\n",
    "\n",
    "        if first1<=second2 and first2 >= second1:\n",
    "            return True\n",
    "        else:\n",
    "            return False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        def compare(t1: str,t2:str)-> int:\n",
    "            h1 = int(t1[0:2])\n",
    "            h2 = int(t2[0:2])\n",
    "            if h1> h2 :\n",
    "                return 1\n",
    "            elif h1 < h2:\n",
    "                return -1\n",
    "            m1 = int(t1[3:])\n",
    "            m2 = int(t2[3:])\n",
    "            if m1 > m2:\n",
    "                return 1\n",
    "            elif m1 < m2:\n",
    "                return -1\n",
    "            else:\n",
    "                return 0\n",
    "        if compare(event1[0],event2[1])== compare(event1[1],event2[0]) and event1[0] != event2[1] and event1[1] != event2[0]:\n",
    "            return False\n",
    "        else:\n",
    "            return True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return event1[1] >= event2[0] and event1[1] <= event2[1] or event1[0] >= event2[0] and event1[0] <= event2[1] or event2[1] >= event1[0] and event2[1] <= event1[1] or event2[0] >= event1[0] and event2[0] <= event1[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        e10 = 60*int(event1[0][0:2]) + int(event1[0][3:5])\n",
    "        e21 = 60*int(event2[1][0:2]) + int(event2[1][3:5])\n",
    "        if e10 > e21 : return False\n",
    "        e11 = 60*int(event1[1][0:2]) + int(event1[1][3:5])\n",
    "        e20 = 60*int(event2[0][0:2]) + int(event2[0][3:5])\n",
    "        if e11 < e20 : return False\n",
    "        return True\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not ((event1[0] > event2[1]) or (event2[0] > event1[1]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return not(event1[1]<event2[0] or event2[1]<event1[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        return event1[1]>=event2[0] and event1[0]<=event2[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def haveConflict(self, event1: List[str], event2: List[str]) -> bool:\n",
    "        for i in event1:\n",
    "            i.replace(':','')\n",
    "        for j in event2:\n",
    "            j.replace(':','')\n",
    "        if event1[0]<=event2[0]<=event1[1] or event1[0]<=event2[1]<=event1[1] or event2[0]<=event1[0]<=event2[1] or event2[0]<=event1[1]<=event2[1]:\n",
    "            return True\n",
    "        else:\n",
    "            return False"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 2
}
